import { Component, OnInit } from '@angular/core';

declare var layui: any;

@Component({
  selector: 'app-navbar',
  templateUrl: './navbar.component.html',
  styleUrls: ['./navbar.component.css']
})
export class NavbarComponent implements OnInit {

  constructor() { }

  ngOnInit() {
    const divIndex = document.getElementById('index');
    const divOrderRoom = document.getElementById('order-room');
    const divOrderFood = document.getElementById('order-food');
    const divManageHotel = document.getElementById('manage-hotel');
    const divManageRoom = document.getElementById('manage-room');
    const divProfile = document.getElementById('profile');

    if (localStorage.getItem('userId') == '1') {
      //管理员登录
    }
    else if (localStorage.getItem('userId') == null) {
      //未登录
      divOrderFood.style.display = 'none';
      divManageHotel.style.display = 'none';
      divManageRoom.style.display='none';
      divProfile.style.display = 'none';
    }
    else{
      //用户
      divManageHotel.style.display = 'none';
      divManageRoom.style.display = 'none';
    }

    layui.use('element', function(){
      var element = layui.element;
    });
    
  }

}
